package dao.impl;

import dao.SysUserMapper;
import org.mybatis.spring.SqlSessionTemplate;
import pojo.SysUser;

import java.util.List;

/**
 * 通过SqlSessionTemplate操作数据库
 */
public class SysUserMapperImpl implements SysUserMapper {
    private SqlSessionTemplate sqlSession;

    @Override
    public List<SysUser> selectSysUserList(SysUser sysUser) {
        return sqlSession.getMapper(SysUserMapper.class).selectSysUserList(sysUser);
    }

    /**
     * 保存用户
     *
     * @param sysUser
     * @return
     */
    @Override
    public int add(SysUser sysUser) {
        return this.getSqlSession().getMapper(SysUserMapper.class).add(sysUser);
    }

    public void setSqlSession(SqlSessionTemplate sqlSession) {
        this.sqlSession = sqlSession;
    }

    public SqlSessionTemplate getSqlSession() {
        return sqlSession;
    }
}
